<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"
      xmlns:text-decoration="http://www.w3.org/1999/xhtml">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">列表</a>
            <a>
              <cite>管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="float: right;height: 30px;line-height: 30px;margin-top: 5px;" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form action="#" class="layui-form layui-col-space5" th:action="@{/student/student}" method="post">
                        <div class="layui-card" th:if="${searchInfo != 1}" th:each="student,count:${pageInfo.list}">
                            <div class="layui-card-header">个人信息</div>
                            <div class="layui-card-body" pad15>

                                <div class="layui-form" lay-filter="">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">学号</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.userName}" type="text" name="username" readonly class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">不可修改</div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">班级</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.className}" type="text" name="username" readonly class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">不可修改</div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">姓名</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.name}" type="text" name="nickname" lay-verify="nickname" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">性别</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.sexTru eq 0 ? '男':'女'}" type="text" name="nickname" lay-verify="nickname" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">年龄</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.age}" type="text" name="nickname" lay-verify="nickname" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">手机</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.phone}" type="text" name="cellphone" lay-verify="phone" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">邮箱</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.email}" type="text" name="email" lay-verify="email" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-form-text">
                                        <label class="layui-form-label">状态</label>
                                        <div class="layui-input-inline">
                                            <input th:value="${student.status}" type="text" name="username" readonly class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">不可修改</div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <a  class="layui-btn ml-5" href="javascript:;"
                                               th:onclick="'javascript:layer_show(\'编辑\',\'/student/'+'student'+'/editBefore/'+${student.id}+'\',900,500)'"
                                                style="text-decoration:none">编辑信息</a>
                                            <a class="layui-btn" href="javascript:;"
                                               th:onclick="'javascript:layer_show(\'信息\',\'/student/'+'student'+'/selectAllInfo/'+${student.classId}+'\',900,500)'">
                                                查看本班人员信息 </a>
                                            <a class="layui-btn ml-5" href="javascript:;"
                                               th:onclick="'javascript:layer_show(\'档案\',\'/student/'+'student'+'/selectFile/'+${student.id}+'\',900,500)'"
                                                style="text-decoration:none">查看档案</a>
                                        </div>
                                    </div>

                                </div>

                            </div>
                        </div>


                        <div th:if="${searchInfo == 1}"  class="layui-card-body" style="text-align: center">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr class="text-c">
                                    <th th:if="${searchInfo != 1}" width="25"><input type="checkbox" name="" value="" lay-filter="checkall" lay-skin="primary"/></th>
                                    <th width="25">序号</th>
                                        <th width="40">学号</th>
                                        <th width="40">班级</th>
                                        <th width="40">姓名</th>
                                        <th width="40">性别</th>
                                        <th width="40">年龄</th>
                                        <th width="40">手机号码</th>
                                        <th width="40">电子邮箱</th>
                                        <th width="40">状态</th>
                                    <th th:if="${searchInfo != 1}" width="100">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="text-c" th:if="${pageInfo.list.size() == 0}">
                                    <td colspan="15"><strong>暂无数据</strong></td>
                                </tr>
                                <tr class="text-c" th:each="student,count:${pageInfo.list}">
                                    <td th:if="${searchInfo != 1}"><input type="checkbox" value="1" th:value="${student.id}"
                                               name="id" lay-skin="primary"/></td>
                                    <td th:text="${count.count}"></td>
                                                <td th:text="${student.userName}"></td>
                                                <td th:text="${student.className}"></td>
                                                <td th:text="${student.name}"></td>
                                                <td th:text="${student.sexTru eq 0 ? '男':'女'}"></td>
                                                <td th:text="${student.age}"></td>
                                                <td th:text="${student.phone}"></td>
                                                <td th:text="${student.email}"></td>
                                                <td th:text="${student.status}"></td>
                                    <td th:if="${searchInfo != 1}" class="td-manage">
                                        <a title="编辑" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'编辑\',\'/student/'+'student'+'/editBefore/'+${student.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe642;</i></a>
                                        <a title="查看本班人员信息" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'信息\',\'/student/'+'student'+'/selectAllInfo/'+${student.classId}+'\',900,500)'"><i class="layui-icon">&#xe613;</i></a>
                                        <a  th:if = "${roleId !=2}"title="记录档案" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'记录档案\',\'/student/'+'student'+'/addBeforeFile/'+${student.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe654;</i></a>

                                        <a title="查看档案" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'档案\',\'/student/'+'student'+'/selectFile/'+${student.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe656;</i></a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:if="${searchInfo == 1}" th:include="_pagination :: page"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>
<!--/_footer 作为公共模版分离出去-->
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({

        });
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });


</script>
</body>
</html>